package com.ellen.mac.chatdemo.adpter;

import android.content.Context;
import android.graphics.Bitmap;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ellen.mac.chatdemo.R;
import com.ellen.mac.chatdemo.utils.LogUtils;
import com.squareup.picasso.Picasso;
import com.yanzhenjie.album.AlbumFile;

import java.util.List;

/**
 * Created by j on 2017/12/13.
 */

public class GalleryAdapter extends BaseQuickAdapter<AlbumFile, BaseViewHolder> {
    private Context context;
    public GalleryAdapter(int layoutResId, List data, Context context) {
        super(layoutResId, data);
        this.context = context;
    }


    @Override
    protected void convert(BaseViewHolder helper, AlbumFile file) {
        ImageView imageView = helper.getView(R.id.image);
        LogUtils.i(file.getWidth()+"==w "+file.getHeight()+"  ==h");
        Picasso.with(context)
                .load("file://"+file.getPath())
                .config(Bitmap.Config.RGB_565)
                .fit()
                .centerCrop()
                .into(imageView);
    }

}
